package GUI;

import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class CreditsPanel extends JPanel implements ActionListener {
	
	private static final long serialVersionUID = 1L;
	//private JFrame frame;
	private JButton menuButton;
	private MenuPanel menuPanel;
	
	public CreditsPanel(JFrame frame, MenuPanel menuPanel) {
		//this.frame = frame;
		this.menuPanel = menuPanel;
		setPreferredSize(new Dimension(800,600));
		setVisible(true);
    	setLayout(null);
    	
    	//Adiciona um botao que volta para o menu
    	menuButton = new JButton(new ImageIcon(getClass().getResource("/Sprites/menuRelease.png")));
    	add(menuButton);
    	menuButton.setBounds(340, 570, 135,24);
    	menuButton.addActionListener(this);  
    }

	public void actionPerformed(ActionEvent e) {
		this.setVisible(false);
		this.menuPanel.setVisible(true);
		this.menuPanel.requestFocus();
	}
	
	public void paintComponent(Graphics g) {  
        super.paintComponents(g);
        g.drawImage(new ImageIcon(getClass().getResource("/Sprites/creditos.png")).getImage(),0,0,null);
    }

}
